/*
 * @lc app=leetcode.cn id=830 lang=cpp
 *
 * [830] 较大分组的位置
 */

// @lc code=start
class Solution
{
public:
  vector<vector<int>> largeGroupPositions(string s)
  {
    int n = s.size();
    vector<vector<int>> ans;
    int L = 0;
    while (L < n) {
      int R = L;
      while (R < n && s[L] == s[R])
        ++R;
      if (R - L >= 3)
        ans.push_back({L, R - 1});
      L = R;
    }
    return ans;
  }
};
// @lc code=end
